package cn.foolishbird.crow.step;

import java.util.Collection;

/**
 * @author foolish-bird
 */
@Deprecated
public abstract class PageStepRead<E> implements StepRead<E> {

    /**
     * 分页页数
     */
    private int pageNum = 1;

    /**
     * 一页多少数据
     */
    private int pageSize = 200;

    public PageStepRead() {
    }

    public PageStepRead(int pageNum, int pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    @Override
    public Collection<E> next() {
        Collection<E> collection = this.doNext();
        this.pageNum++;
        return collection;
    }

    protected abstract Collection<E> doNext();

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
}
